
namespace HtERP.Services;

/// <summary>
/// 配置服务接口
/// </summary>
public interface IConfigService
{
    /// <summary>
    /// 获取配置
    /// </summary>
    /// <typeparam name="T">配置类型</typeparam>
    /// <param name="sectionName">配置节名称</param>
    /// <returns>配置对象</returns>
    T GetConfig<T>(string sectionName);
    
    /// <summary>
    /// 更新配置
    /// </summary>
    /// <typeparam name="T">配置类型</typeparam>
    /// <param name="sectionName">配置节名称</param>
    /// <param name="config">配置对象</param>
    /// <returns>是否更新成功</returns>
    Task<bool> UpdateConfigAsync<T>(string sectionName, T config);
    
    /// <summary>
    /// 获取默认备份路径
    /// </summary>
    /// <returns>默认备份路径</returns>
    string GetDefaultBackupPath();
    
    /// <summary>
    /// 设置默认备份路径
    /// </summary>
    /// <param name="path">备份路径</param>
    /// <returns>是否设置成功</returns>
    Task<bool> SetDefaultBackupPathAsync(string path);
    
    /// <summary>
    /// 获取默认保留数量
    /// </summary>
    /// <returns>默认保留数量</returns>
    int GetDefaultRetentionCount();
    
    /// <summary>
    /// 设置默认保留数量
    /// </summary>
    /// <param name="count">保留数量</param>
    /// <returns>是否设置成功</returns>
    Task<bool> SetDefaultRetentionCountAsync(int count);
}